package ua.ck.example.domain;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "products")
public class Product implements java.io.Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6681344576137640181L;

	@Id
	@GeneratedValue
	private Integer productId;
	private String productName;
	private double incomePrice;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "providerId", nullable = false)
	private Provider provider;
	private int quantity;
	private double salesPrice;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "categoryId", nullable = false)
	private Category category;
	@OneToMany(fetch = FetchType.EAGER, mappedBy = "product")
	private Set<OrderDetail> orderDetail = new HashSet<OrderDetail>(0);
	@Transient
	private int categoryId;

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public int getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(int categoryId) {
		this.categoryId = categoryId;
	}

	public Integer getProductId() {
		return productId;
	}

	public void setProductId(Integer productId) {
		this.productId = productId;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public double getIncomePrice() {
		return incomePrice;
	}

	public void setIncomePrice(double incomePrice) {
		this.incomePrice = incomePrice;
	}

	public int getQuantity() {
		return quantity;
	}

	public Provider getProvider() {
		return provider;
	}

	public void setProvider(Provider provider) {
		this.provider = provider;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	public double getSalesPrice() {
		return salesPrice;
	}

	public void setSalesPrice(double salesPrice) {
		this.salesPrice = salesPrice;
	}

	public Set<OrderDetail> getOrderDetail() {
		return orderDetail;
	}

	public void setOrderDetail(Set<OrderDetail> orderDetail) {
		this.orderDetail = orderDetail;
	}

}
